package com.jfeat.am.module.wegou.api.crud;

import com.jfeat.am.common.annotation.Permission;
import com.jfeat.am.common.constant.tips.SuccessTip;
import com.jfeat.am.common.constant.tips.Tip;
import com.jfeat.am.common.controller.BaseController;
import com.jfeat.am.module.wegou.api.permission.ProductStorePermission;
import com.jfeat.am.module.wegou.services.crud.service.ProductStoreService;
import com.jfeat.am.module.wegou.services.patch.WeGouPatchService;
import com.jfeat.am.module.wegou.services.persistence.model.Product;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Created by Administrator on 2018/2/1.
 */
@Api("管理员管理 料理店铺API")
@RestController
@RequestMapping("/api/adm")
public class AdmEndpoint extends BaseController{

    @Resource
    WeGouPatchService weGouPatchService;
    @Resource
    ProductStoreService productStoreService;

    @ApiOperation(value = "管理员权限 将料理店设置为禁止登陆", response = Product.class)
    @Permission(ProductStorePermission.ProductRestaurant_UPDATE)
    @PostMapping("/restaurant/{resId}/banned")
    public Tip setRestaurantAsProhibition(@PathVariable long resId) {
        return SuccessTip.create(weGouPatchService.setRestaurantAsProhibitionOrDown(resId));
    }

}
